/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.edu.com1263.model;

import java.io.Serializable;
import java.util.Collection;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Luiz Cardoso
 */
@Entity
@Table(name="disciplina")
public class Disciplina implements Serializable{
	
	static final long serialVersionUID = 1145044791793649333L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name="id_disc")
	private Long id;
	
	@Column(name="cod_disc", nullable=false)
    String codDisciplina;
	
	@Column(name="nome_disc", nullable=false)
    String nomeDisciplina;
	
	
	
	@ManyToOne
	@JoinColumn(name = "id_curso")
    private Curso curso;

	
	@OneToMany(cascade = { CascadeType.ALL }, mappedBy = "disciplina")
	private Collection<Turma> turmas;

    
	

    public Disciplina() {

	}


	public Disciplina(String codDisciplina, String nomeDisciplina) {
    	this.codDisciplina = codDisciplina;
        this.nomeDisciplina = nomeDisciplina;
      
    }

    
    public String getCodDisciplina() {
        return codDisciplina;
    }

   

    public String getNomeDisciplina() {
        return nomeDisciplina;
    }

    
    public void setCodDisciplina(String codDisciplina) {
        this.codDisciplina = codDisciplina;
    }

    

    public void setNomeDisciplina(String nomeDisciplina) {
        this.nomeDisciplina = nomeDisciplina;
    }
    
    public Curso getCurso() {
		return curso;
	}

	public void setCurso(Curso curso) {
		this.curso = curso;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Collection<Turma> getTurmas() {
		return turmas;
	}

	public void setTurmas(Collection<Turma> turmas) {
		this.turmas = turmas;
	}
	

}
